package cn.edu.tju.elm.repository;

import cn.edu.tju.elm.model.Food;
import org.hibernate.query.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.awt.print.Pageable;
import java.util.List;

public interface FoodRepository extends JpaRepository<Food, Long> {
    /**
     * 根据店铺ID查询所有商品
     */
    List<Food> findByBusinessId(Long businessId);



    List<Food> findByIdIn(List<Long> foodIds);


    /**
     * 根据店铺ID和商品名称查询
     */
    List<Food> findByBusinessIdAndFoodName(Long businessId, String foodName);

    /**
     * 根据商品名称模糊查询（指定店铺）
     */
    List<Food> findByBusinessIdAndFoodNameContaining(Long businessId, String foodName);

    /**
     * 检查商品是否存在
     */
    boolean existsById(Long id);
}
